<?php
namespace app\user\event\subscribes\teacher;

use app\admin\logic\system\Message;
use think\Event;

class Teacher
{
    public function subscribe(Event $event)
    {
        // 提交了讲师认证
        $event->listen('TeacherAuthSubmit', function ($teacher) {
            // 申请人信息
            $teacher = $teacher->appendRelationAttr('school', ['admin_user_id'])->appendRelationAttr('user', ['user_phone' => 'phone', 'nick_name']);

            Message::send('讲师审核提醒', '用户【' . $teacher->getAttr('nick_name') . '/' . $teacher->getAttr('user_phone') . '】提交了认证讲师申请', $teacher->getAttr('admin_user_id'), 'teacher');
        });
    }
}
